package com.xiaomuwu.android.ui.detail

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.xiaomuwu.android.logic.Repository
import com.xiaomuwu.android.logic.model.ForUserDetail

class UserDetailViewModel:ViewModel() {

    private val toUserDetailLiveData=MutableLiveData<ForUserDetail>()

    val userDetailLiveData=Transformations.switchMap(toUserDetailLiveData){forUserDetail->
        Repository.getUserDetail(forUserDetail)
    }

    fun getUserDetailLiveData(forUserDetail:ForUserDetail){
        toUserDetailLiveData.value=forUserDetail
    }

}